< previous page page_62 next page >

Page 62
that you might need. The first thing that you need to do with the Font dialog box is to set the Flags property. This is more important for fonts than any of the other dialog boxes. If you use the wrong settings, no fonts will be displayed to users.
Caution
If you don't set a value for the
Flags property, you actually get an error message telling you that no fonts are installed on your computer.

The two most commonly used settings are:
cdlCFBoth, which displays all available printer and screen fonts in the list box
cdlCFEffects, which enables the strikethrough, underline, and color options on the Font dialog box
The Font dialog box is displayed by invoking the ShowFonts method (see Figure 2.9). Depending on the control you're changing the font information for, you would need to set one or more of the properties for that control.
12181-0062a.gif
Figure 2.9.
The Font dialog box allows users to modify
all the different font properties available.
The example I'm using to show you how to use the Font dialog box makes use of a Rich TextBox control and the Open dialog box to get the text file to display. To see how to control fonts, create a new project and format the form as shown in Figure 2.10 by using the Microsoft Rich TextBox control. Then add the code in Listing 2.3 to the form.

 
< previous page page_62 next page >

If you like this book, buy it!